home *** CD-ROM | disk | FTP | other *** search
- Path: interramp.com!usenet
- From: us017159@interramp.com (Tom Schecker)
- Newsgroups: comp.lang.c++
- Subject: Re: CGI application
- Date: Sat, 30 Mar 1996 22:57:08 GMT
- Organization: PSI Public Usenet Link
- Message-ID: <4jke6r$79o@usenet7.interramp.com>
- References: <3156BE73.2F6B@lia.infolink.co.za>
- NNTP-Posting-Host: ip191.newark.nj.interramp.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- Louis Viljoen <lviljoen@lia.infolink.co.za> wrote:
-
- >I would like to know more about cgi applications. I am trying to write
- >some basic applications using BC4.53. In my cgi-application I used the
- >printf() or fprinf(stdout,) functions to write to the standard output
- >steam. If I execute the cgi-application from within my homepage I don't
- >get the output at the client-side, but if I execute the cgi-application
- >directly the output is generated at the client as intended.
- >What do I need to do to get the output when executing from my page.
-
- >Louis Viljoen
-
- I am extremely new to this area, but I happened to try this same thing
- just yesterday. Using VC++4.0, the following created a HTML file
- displaying a list of the Environment variables:
-
- #include <iostream.h>
- #include <string.h>
-
- void main( int argc, char *argv[], char *envp[] )
- {
- int iNumberLines = 0; // Default is no line numbers.
- cout << "Content-type: text/html\n\n";
- cout << "";
- cout << "<HTML>\n";
- cout << "<HEAD>\n";
- cout << "<TITLE>title here</TITLE>\n";
- cout << "</HEAD>\n";
- cout << "<BODY>\n";
- cout << "<P>This is the stuff from C++ as modified.\n";
- for( int i = 0; envp[i] != NULL; ++i )
- {
- // if( iNumberLines )
- cout << "<P>" << i << ": " << envp[i] << "\n";
- }
- cout << "</BODY>\n";
- cout << "</HTML>\n";
- }
-
- You might also be interested to know of a web site I found yesterday
- that offers cgi Class (object, not education) to help parse the
- variables. It's at :
- http://sweetbay.will.uiuc.edu/cgi%2b%2b/
-
- Hope this helps.
-
- Tom Schecker
-
-